// 该文件专门用于创建整个应用的路由器
import VueRouter from "vue-router";
// 引入组件
import About from "../pages/About.vue";
import Home from "../pages/Home.vue";
import Message from "../pages/Message.vue";
import News from "../pages/News.vue";

// 创建一个路由器（简写）
export default new VueRouter({
  routes: [
    {
      path: "/about",
      component: About,
    },
    {
      path: "/home",
      component: Home,
      children: [ //通过children配置子级路由
        {
          path: "news", //此处一定不要写：/news
          component: News,
        },
        {
          path: "message", //此处一定不要写：/message
          component: Message,
        },
      ],
    },
  ],
});

// 创建并暴露一个路由器（全写）
/* const router = new VueRouter({
    routes:[
        {
            path:'/about',
            component:About
        },
        {
            path:'/home',
            component:Home
        }
    ]
})

// 暴露一个路由器（默认暴露）
export default router */
